1 00:00:01,410 --> 00:00:04,000 ‫Welcome to our 10th lecture. 2 00:00:04,380 --> 00:00:09,820 ‫Now, we have been writing our apps here, we have an to add items have only you to get all the items. 3 00:00:10,140 --> 00:00:15,630 ‫Now, I would like us to do something about editing the item because you are having a mobile app that 4 00:00:15,630 --> 00:00:17,280 ‫is consuming your ERP. 5 00:00:17,280 --> 00:00:19,770 ‫Next instance, do an app that you have written. 6 00:00:20,040 --> 00:00:24,400 ‫You need to allow your users to be able to edit items inside of this application. 7 00:00:24,420 --> 00:00:24,830 ‫All right. 8 00:00:25,200 --> 00:00:27,480 ‫So let us read the function of the function here. 9 00:00:27,480 --> 00:00:31,470 ‫That is you when to call maybe something like did an item. 10 00:00:32,010 --> 00:00:37,810 ‫And here we are going to write a query that is going to go ahead and update our items. 11 00:00:38,130 --> 00:00:39,030 ‫So what do you want to do? 12 00:00:39,030 --> 00:00:45,150 ‫Here is frappé dot DBI don't ask. 13 00:00:45,150 --> 00:00:49,180 ‫You will probably be Esquibel. 14 00:00:49,200 --> 00:00:53,310 ‫And then what you want to be doing here is that we are going to be supplying a formatted string. 15 00:00:53,310 --> 00:00:55,560 ‫Remember here are doing six. 16 00:00:55,680 --> 00:00:58,110 ‫How many of those now. 17 00:00:58,110 --> 00:00:58,820 ‫Those are six. 18 00:00:59,070 --> 00:01:09,240 ‫And then here I am going to do update CC update and then the next thing I'm going to be supplying here 19 00:01:09,660 --> 00:01:10,590 ‫is my table. 20 00:01:10,590 --> 00:01:12,690 ‫So my table is tab item. 21 00:01:12,970 --> 00:01:17,390 ‫OK, so this is going to be the table of the table that you editing. 22 00:01:17,970 --> 00:01:20,130 ‫So update tab item. 23 00:01:20,490 --> 00:01:22,860 ‫And then what I'm going to do here, I want to set. 24 00:01:23,820 --> 00:01:28,530 ‫Nor do I want to sit here and again, remember this one who can pass anything so this for the purpose 25 00:01:28,530 --> 00:01:32,460 ‫of this one, this tutorial, let me edit this item. 26 00:01:32,460 --> 00:01:35,160 ‫This one, the first time I was doing I was testing it. 27 00:01:35,460 --> 00:01:39,780 ‫So you can see our second and third items are still called second them. 28 00:01:39,880 --> 00:01:47,910 ‫That item is when I return to updated fast API items so we can change our second item in changes to 29 00:01:47,910 --> 00:01:49,560 ‫update its agenda items. 30 00:01:49,560 --> 00:01:53,430 ‫So so we can get we can change the item name. 31 00:01:54,930 --> 00:01:56,790 ‫So item name. 32 00:01:57,270 --> 00:02:04,260 ‫So that said, item name and then we said the item name that we want Hyogo into hard code for now, 33 00:02:04,620 --> 00:02:11,570 ‫but we are going to be writing these things and expecting them to come from from from a parameter letter. 34 00:02:11,580 --> 00:02:16,500 ‫So the updated second item. 35 00:02:17,770 --> 00:02:18,330 ‫All right. 36 00:02:18,660 --> 00:02:24,180 ‫And then you remember in an update function of an API, you need to supply them. 37 00:02:24,200 --> 00:02:24,390 ‫We. 38 00:02:24,690 --> 00:02:27,210 ‫So you need to tell it where you want this thing to happen. 39 00:02:27,210 --> 00:02:31,170 ‫Because if you do this, it is going to update everything to this. 40 00:02:31,320 --> 00:02:33,210 ‫So you don't want that thing to do. 41 00:02:33,270 --> 00:02:34,770 ‫You don't want to agree to do that. 42 00:02:35,190 --> 00:02:37,020 ‫What you want to do is we are name. 43 00:02:37,030 --> 00:02:43,560 ‫Remember I told you again, name in ERP next is used as the primary key so we can see we are named equals 44 00:02:43,950 --> 00:02:47,880 ‫and we can check the name of this is way, way, way, way for Weisse. 45 00:02:47,880 --> 00:02:49,460 ‫So y y y y right. 46 00:02:50,610 --> 00:02:57,450 ‫So we are seeing update this set item name equals this one second API. 47 00:02:57,510 --> 00:03:01,610 ‫Don't forget API then because we want to retain that we are name. 48 00:03:01,620 --> 00:03:02,520 ‫Is this OK. 49 00:03:02,820 --> 00:03:11,340 ‫And then the next thing you're going to do after that is just to say frappé dot dbe dot com meet. 50 00:03:12,130 --> 00:03:13,160 ‫I hope you guessed it. 51 00:03:13,170 --> 00:03:15,200 ‫Yeah probably it. 52 00:03:15,240 --> 00:03:19,770 ‫And then we can just go ahead of course and return a message saying success. 53 00:03:19,770 --> 00:03:22,080 ‫This one again written whatever you want or done here. 54 00:03:22,440 --> 00:03:28,140 ‫But this one I'm just going to give us a text message thing that it has successfully that our our function. 55 00:03:28,410 --> 00:03:32,340 ‫So remember that if we leave this, there is not going to work. 56 00:03:32,340 --> 00:03:38,730 ‫So we need to do Frappier for a bit or at least so that everything is accessible. 57 00:03:39,150 --> 00:03:40,280 ‫We allow us to use. 58 00:03:40,830 --> 00:03:44,160 ‫And then what you want to do next is go back to your posthuman. 59 00:03:44,460 --> 00:03:46,020 ‫I had already tested it here. 60 00:03:46,350 --> 00:03:51,540 ‫And what you want to do is you're going to add you are you are you are in here. 61 00:03:53,070 --> 00:03:54,750 ‫This is supposed to be a post request. 62 00:03:55,230 --> 00:03:56,370 ‫You're going to add. 63 00:03:56,370 --> 00:04:04,260 ‫And by the way, even the the ad is going to be a post request not get so we can add something like 64 00:04:04,260 --> 00:04:09,510 ‫a D and then this is going to be for the. 65 00:04:11,760 --> 00:04:18,800 ‫We believe that sended and we have our item and we come to they did realize that it has had enough of 66 00:04:19,280 --> 00:04:19,410 ‫them. 67 00:04:19,470 --> 00:04:22,040 ‫So yes, this is supposed to be a post request. 68 00:04:22,590 --> 00:04:25,280 ‫Update is all going to be is supposed to be a post request. 69 00:04:25,610 --> 00:04:29,060 ‫When you will be working the front end applications, they are going to be very, very sensitive. 70 00:04:29,060 --> 00:04:34,640 ‫So you need to know exactly when will you pull up post and when you call and get because you will be 71 00:04:34,640 --> 00:04:42,320 ‫needing to do other things with the staff like crows, cause that is gross origin request and request 72 00:04:42,320 --> 00:04:42,930 ‫and all that. 73 00:04:42,950 --> 00:04:43,250 ‫All right. 74 00:04:44,600 --> 00:04:48,560 ‫So put you are you are you are you are you are FBI here. 75 00:04:48,650 --> 00:04:51,980 ‫Mine is my next update item. 76 00:04:52,520 --> 00:04:59,810 ‫So I'm going to put it here and then remember to pass the authorization token because I do not want 77 00:05:00,320 --> 00:05:05,720 ‫this one to be our function that is open to the public. 78 00:05:05,720 --> 00:05:08,270 ‫I'm not going to be allowing this to be accessible to the public. 79 00:05:08,690 --> 00:05:11,180 ‫I want it to be protected behind. 80 00:05:11,330 --> 00:05:17,300 ‫I talked to said this, and when you see this one return on success message, it means that it has successfully 81 00:05:17,300 --> 00:05:17,820 ‫updated. 82 00:05:17,840 --> 00:05:19,400 ‫And let's go back to the database. 83 00:05:19,910 --> 00:05:22,060 ‫See, it is now second item. 84 00:05:22,400 --> 00:05:26,270 ‫We reload and yes, we have an item and that's it. 85 00:05:26,570 --> 00:05:35,840 ‫That is how we write an API to update our our item list inside of ERP. 86 00:05:35,840 --> 00:05:38,600 ‫Next, they get so much in the next lecture. 87 00:05:38,600 --> 00:05:45,350 ‫What we're going to be looking at is how to delete an item from our database. 88 00:05:45,350 --> 00:05:46,940 ‫See you in that lecture.